<template>
  <el-button
    type="warning"
    icon="Download"
    size="default"
    @click="click"
    v-hasPermi="perm"
    v-hasRole="role"
    v-hasRoleType="roleType"
  >{{ text }}</el-button
  >
</template>

<script>
export default {
  name: 'ExportButton',
  inheritAttrs: false,
  props: {
    text: {
      type: String,
      required: false,
      default: () => '导出'
    },
    perm: {
      type: Array,
      required: false,
      default: () => []
    },
    role: {
      type: Array,
      required: false,
      default: () => []
    },
    roleType: {
      type: Array,
      required: false,
      default: () => []
    }
  },
  methods: {
    click() {
      this.$confirm('是否确认导出所有的数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.$emit('click')
        })
        .catch((e) => {
          console.log(e)
        })
    }
  }
}
</script>
